﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Farmacia.Entities;
using Farmacia.DataAccess;
using Microsoft.Practices.Unity;

namespace Farmacia.BussinessLogic
{
    public class ClienteBL:iClienteBL 
    {
        
        [Dependency]
        public iClienteDAO ClienteDAO { get; set; }

        public List<Cliente> GetAllFromCliente()
        {
            return ClienteDAO.GetAllFromCliente();  
        }

        public Cliente GetFromClienteByRucDni(string rucDni)
        {
            return ClienteDAO.GetFromClienteByRucDni(rucDni); 
        }

        public void RegistrarCliente(Cliente cliente)
        {
            ClienteDAO.RegistrarCliente(cliente); 
        }



        public List<Cliente> GetFromClienteByRazonSocialAndRucDni(string criterio)
        {
            return ClienteDAO.GetFromClienteByRazonSocialAndRucDni(criterio);
        }






        public Cliente GetFromClienteById(Int32 id)
        {
            return ClienteDAO.GetFromClienteById(id);
        }


        public void DeleteCliente(Int32 id)
        {
            try
            {
                ClienteDAO.GetFromClienteById(id);
            }
            catch (Exception ex)
            {

                throw new ApplicationException(ex.Message);
            }
        }
    }
}
